<!DOCTYPE html>
<!-- saved from url=(0052)http://getbootstrap.com/docs/4.0/examples/dashboard/ -->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<meta name="description" content="">
		<meta name="author" content="">

		<title>Dashboard Template for Bootstrap</title>
		<!-- Bootstrap core CSS -->
		<link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">

		<!-- Custom styles for this template -->
		<link th:href="@{/css/dashboard.css}" rel="stylesheet">
		<style type="text/css">
			/* Chart.js */
			
			@-webkit-keyframes chartjs-render-animation {
				from {
					opacity: 0.99
				}
				to {
					opacity: 1
				}
			}
			
			@keyframes chartjs-render-animation {
				from {
					opacity: 0.99
				}
				to {
					opacity: 1
				}
			}
			
			.chartjs-render-monitor {
				-webkit-animation: chartjs-render-animation 0.001s;
				animation: chartjs-render-animation 0.001s;
			}
		</style>
	</head>

	<body>
	<!--导航栏-->
          <div th:replace="~{commons/commons::navbar}"></div>

		<div class="container-fluid">
			<div class="row">
             <!--插入抽离的侧边栏-->
				<div th:replace="~{commons/commons::sidebar(active='cus')}"></div>


				<main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
					<h2><a class="btn btn-sm btn-success" th:href="@{/user/emp}" >添加员工</a></h2>

					<div class="table-responsive">
						<!--<p style="color: red" th:text="${session.dele}" th:if="${not #strings.isEmpty(session.dele)}" ></p>-->
						<p style="color: red" th:text="Eee" th:if="${session.dele}"></p>
						<!--<p style="color: red" th:text="${msg}" th:if="${not #strings.isEmpty(msg)}" ></p> 作用域一次请求-->
						<!--<h1 style="color: red" th:text="${#request.getSession().getAttribute('dele')}" th:if="${#request.getSession().getAttribute('dele')}" ></h1>-->
						<!--<h1 style="color: red" th:if="${#request.getSession().getAttribute('dele')}" >[[${dele}]]</h1> 不行-->
						<!--<h1 style="color: red" th:text="${#request.getSession().getAttribute('dele')}"></h1>-->
						<table class="table table-striped table-sm">
							<thead>
								<tr>
									<th>id</th>
									<th>lastname</th>
									<th>email</th>
									<th>gender</th>
									<th>department</th>
									<th>birth</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								<tr th:each="emp:${employees}">
									<td th:text="${emp.getId()}"></td>
									<td th:text="${emp.getLastName()}"></td>
									<td th:text="${emp.getEmall()}"></td>
									<td th:text="${emp.getGender()==0? '女':'男'}"></td>
									<td th:text="${emp.getDepartment().getDepartmentName()}"></td>
									<td th:text="${#dates.format(emp.getBirth(),'yyyy-MM-dd hh:mm:ss')}"></td>
									<td th:text="${emp.getBirth()}"></td>
									<!--<td th:text="${#dates.format(emp.getBirth())}"></td>-->

                                    <td>
										<a class="btn btn-sm btn-primary" th:href="@{/user/emp/}+${emp.getId()}">修改</a>
										<a class="btn btn-sm btn-danger" th:href="@{/user/del(id=${emp.getId()})}"> 删除</a>
										<!--<a class="btn btn-sm btn-danger" th:href="@{/user/del(id=${emp.getId()})}" onclick="MsgBox()">删除</a>-->
									</td>
								</tr>
							</tbody>
						</table>
					</div>
				</main>
			</div>
		</div>

		<!-- Bootstrap core JavaScript
    ================================================== -->
		<!-- Placed at the end of the document so the pages load faster -->
		<script type="text/javascript" src="asserts/js/jquery-3.2.1.slim.min.js"></script>
		<script type="text/javascript" src="asserts/js/popper.min.js"></script>
		<script type="text/javascript" src="asserts/js/bootstrap.min.js"></script>

		<!-- Icons -->
		<script type="text/javascript" src="asserts/js/feather.min.js"></script>
		<script>
			feather.replace()
		</script>

		<!--&lt;!&ndash; Graphs &ndash;&gt;
		<script type="text/javascript" src="asserts/js/Chart.min.js"></script>
		<script>
			var ctx = document.getElementById("myChart");
			var myChart = new Chart(ctx, {
				type: 'line',
				data: {
					labels: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
					datasets: [{
						data: [15339, 21345, 18483, 24003, 23489, 24092, 12034],
						lineTension: 0,
						backgroundColor: 'transparent',
						borderColor: '#007bff',
						borderWidth: 4,
						pointBackgroundColor: '#007bff'
					}]
				},
				options: {
					scales: {
						yAxes: [{
							ticks: {
								beginAtZero: false
							}
						}]
					},
					legend: {
						display: false,
					}
				}
			});
		</script>-->

	<script th:inline="javascript">
		function MsgBox() //声明标识符
		{
			var msg = [[${session.dele}]];//使用el表达式

			$.ajax({
				/*type: 'post',
				contentType: 'application/json',*/
				url: "/quit",
				/*data:"{username:'"+username+"',password:'"+password+"'}",
				dataType: 'json',*/
				success: function (result) {
                        alert("????")
				}
			});
			if (msg !== null)
			alert(msg); //弹出对话框
		}
		MsgBox();
	</script>



		</body>

</html>